package ascript.utilities
{
	//#########################
	// Header Includes
	//#########################
	import starling.display.Image;
	import starling.display.Sprite;
	import starling.textures.Texture;
	
	//#########################
	// GraphicsBasic Class
	//#########################
	public class GraphicsBasic extends Sprite
	{
		//=========================
		// Constructors
		//=========================		
		public function GraphicsBasic( tTexture:Texture, tIsVisible:Boolean, tLocation:PointSimple, tLocationLocal:PointSimple, tPivot:PointSimple ):void
		{
			x = tLocation.x;
			y = tLocation.y;
			pivotX = tPivot.x;
			pivotY = tPivot.y;			
			visible = tIsVisible;
						
			addGraphic( tTexture, tLocationLocal );
		}
		
		//=========================
		// Members
		//=========================	
		public function addGraphic( tTexture:Texture, tLocationLocal:PointSimple = null ):void
		{
			var tempImage:Image = new Image( tTexture);
			
			tempImage.smoothing = "none";
			
			if ( tLocationLocal != null )
			{
				tempImage.x = tLocationLocal.x;
				tempImage.y = tLocationLocal.y;
			}
				
			addChild( tempImage );
		}
		
		public function flattenGraphic( tIsFlattened:Boolean = true ):void
		{
			if ( tIsFlattened )
			{
				flatten();
			}
			else
			{
				unflatten();
			}
		}
	}
}